package com.finesys.backend.common.model.base;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * <p>Title: 分页请求参数</p>
 * <p>Description: </p>
 * <p>Copyright: CopyRight (c) 2020-2035</p>
 * <p>Company: finesys Co. LTD.</p>
 * <p>Author: lehoon</p>
 * <p>Date: 2020/10/21 16:42</p>
 */
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class PageRequest implements Serializable {
    /**当前页码*/
    private int page;
    /**每页显示条数*/
    private int limit;
    /**参数*/
    private Map<String, Object> params;

    public void pushParam(String key, Object value) {
        if(this.params == null) {
            this.params = new HashMap<String, Object>(8);
        }

        if(this.params.containsKey(key)) {
            return;
        }

        this.params.put(key, value);
    }
}
